<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="filters">
				<el-form-item>
					<el-input v-model="filters.name" placeholder="项目名"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="getProjects">查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>
	
		<!--列表-->
		<template>
				<el-table :data="projects" border v-loading="loading" style="width: 100%;">
					<el-table-column prop="id" label="项目ID" width="180">
					</el-table-column>
					<el-table-column prop="project_name" label="项目名称" width="180" sortable>
					</el-table-column>
					<el-table-column
						
						label="操作"
						>
						<template scope="scope">
							<el-button
							size="small"
							type="success"
							@click="showDeployDetail(scope.row)">查看部署配置</el-button>
						</template>
					</el-table-column>
				</el-table>
		</template>
	</section>
</template>

<script>
	import {
		getProjectList
	} from '../../api/api';
	//import NProgress from 'nprogress'
	export default {
		data() {
			return {
				filters: {
					name: ''
				},
				loading: false,
				projects: []
			}
		},
		methods: {
			//获取用户列表
			getProjects: function() {
				let para = {
					name: this.filters.name
				};
				this.loading = true;
				//NProgress.start();
				getProjectList(para).then((res) => {
					console.log(res.data)
					this.projects = res.data;
					this.loading = false;
					//NProgress.done();
				});
			},
			showDeployDetail: function ( project_item ){
				// TODO: 跳转 project_item
			}
		},
		mounted() {
			this.getProjects();
		}
	};
</script>

<style scoped>
	
</style>